home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2002 November / SGI IRIX 6.5 Applications 2002 November.iso / dev / insight_dev.idb / usr / share / Insight / bin / bsnap.z / bsnap
Text File  |  2002-10-15  |  906b  |  46 lines

  1. #!/bin/sh
  2. file=snap.rgb
  3. sleep=0
  4. noborder=false
  5. verbose=false
  6. while test $# -gt 0
  7. do
  8.         case "$1" in
  9.         -s) sleep=$2
  10.             shift ;;
  11.         -n) noborder=true ;;
  12.         -v) verbose=true ;;
  13.         *) file=$1 ;;
  14.         esac
  15.         shift
  16. done
  17. if $noborder
  18. then
  19.     left=0
  20.     right=0
  21.     top=0
  22.     bottom=0
  23. else
  24.     left=5
  25.     right=5
  26.     top=29
  27.     bottom=5
  28. fi
  29. echo Screen snap will occur in $sleep seconds after mouse click
  30. cmd=`(echo $left $right $top $bottom ; xwininfo) |
  31. awk '\
  32. NR==1{left=$1;right=$2;top=$3;bottom=$4}
  33. $0~/Absolute upper-left X:/{ux=$4}
  34. $0~/Absolute upper-left Y:/{uy=$4}
  35. $0~/Width:/{width=$2}
  36. $0~/Height:/{height=$2}
  37. END{print "scrsave '"$file"'",ux-bottom,ux+width-1+left,1024-(uy+height)-bottom,1023-uy+top}'`
  38. $verbose && echo $cmd
  39. (if test $sleep -gt 0
  40.  then
  41.         (sleep $sleep ; echo '' ; sh -c "$cmd")
  42.  else
  43.         sh -c "$cmd"
  44.  fi)
  45. echo Saved file as $file
  46.